package com.zdd.chap4a.controller;

import com.zdd.chap4a.entity.ClassInfo;
import com.zdd.chap4a.service.ClassinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ClassinfoController {
    @Autowired
    private ClassinfoService classinfoService;
    @GetMapping("/classinfos/{id}")
    public ModelAndView findClassinfoById(@PathVariable("id")int classno){
        ClassInfo classInfo=classinfoService.findClassinfoById(classno);
        ModelAndView mv=new ModelAndView();
        mv.addObject("classinfo",classInfo);
        mv.setViewName("classinfo");
        return mv;
    }
}
